//
//  AudioPlayManager.h
//  AudioPlayDemo
//
//  Created by jianglinjie on 14-1-17.
//  Copyright (c) 2014年 jianglingjie. All rights reserved.
//
#import "FSAudioController.h"
#import "FSAudioStream.h"
#import <Foundation/Foundation.h>
extern NSString* const AudioPlayManagerLoading;//在线流媒体播放才会有这个通知

extern NSString* const AudioPlayManagerPlaying; //正在播放
extern NSString* const AudioPlayManagerPaused;  //暂停
extern NSString* const AudioPlayManagerStopped; //停止
extern NSString* const AudioPlayManagerPlayingFinished; //正常播放结束
extern NSString* const AudioPlayManagerError;    //错误

extern NSString* const AudioPlayManagerProgressUpdated;//定时器通知

typedef NS_ENUM(NSUInteger, AudioPlayManagerState)
{
    AudioPlayManagerStateStopped,  //停止，初始状态，播放结束，停止播放，等都会导致这个状态，注意和pause的区别
    AudioPlayManagerStateError,
    AudioPlayManagerStateLoading,  //在线视频独有的状态
    AudioPlayManagerStatePlaying,  //播放状态
    AudioPlayManagerStatePaused,  //暂停状态，可以随时恢复播放。

};


@interface AudioPlayManager : NSObject


+(AudioPlayManager *)shareObject;
- (void) setAudioURL:(NSString*)url playImmediately:(BOOL)startImmediately isLocal:(BOOL)isLocal;
- (void) start; //开始播放和stop对应，刚开始设置url或者stop过后调用,pause也可调用（实际调用的是resume）。
- (void) stop; //停止播放，currentTime = 0;
- (void) pause; //暂停
- (void) resume; //恢复播放,如果不想判断状态，推荐调用start。
- (void) seekToMinutes:(unsigned int) minute Seconds:(unsigned int)second;
- (BOOL) isPlaying;

@property(strong,nonatomic,readonly) NSString *currentAudioURL;
@property(assign,nonatomic,readonly) AudioPlayManagerState  state;
@property(assign,nonatomic,readonly) CGFloat  duration; //in seconds
@property(assign,nonatomic,readonly) CGFloat  durationPreview;
@property(assign,nonatomic,readonly) CGFloat  currenPlayedTime; //in seconds
@property(assign,nonatomic,readonly) CGFloat  currenPlayedTimePreview;
@property(assign,nonatomic,readonly) CGFloat  currentPlayedProgress; //0-－1
@property(assign,nonatomic,readonly) CGFloat  currentPlayedProgressPreview;
@property(assign,nonatomic) BOOL enableProgressUpdateTimer;

@property (nonatomic,strong)  FSAudioController *audioController;


@end
